// AutoCADModelObserver.h: interface for the AutoCADModelObserver class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_AUTOCADMODELOBSERVER_H__48A8DEE0_5322_4E36_AB37_1191D4119EF1__INCLUDED_)
#define AFX_AUTOCADMODELOBSERVER_H__48A8DEE0_5322_4E36_AB37_1191D4119EF1__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ModelObserver.h"
#include "SHModelEntityReator.h"
#include <gemat3d.h>
#include <dbdict.h>
#include <afxtempl.h>
#include "Dictionary.h"
using namespace DictionaryFacade;

class AutoCADModelObserver : public ModelObserver  
{
public:
	AutoCADModelObserver();
	virtual ~AutoCADModelObserver();

public:
	virtual void Erase() = 0;
	virtual void UnErase() = 0;
	virtual AutoCADModelObserver& operator=(const AutoCADModelObserver& other);

	const AcGeMatrix3d& Matrix(){
		BOOL bResult = m_DicHandle.GetValue(strMatrixName, m_Matrix);
		ASSERT(bResult);
		return m_Matrix;
	}

	virtual void SetDicHandle(const Dictionary& handle) = 0;
	const AcDbHandle& EntityHandle(){
		BOOL bResult = m_DicHandle.GetValue(strHandleName, m_handle);
		ASSERT(bResult);
		return m_handle;
	}

	operator AcDbHandle(){
		return (AcDbHandle)m_DicHandle;
	}

protected:
	void AddReactorToEntity(AcDbEntityReactor* pReactor);
	void DisableUndoRecording(Adesk::Boolean disable);
	AcDbDictionary* GetDictionary();
	CString GetValue(const CString& strName);
	void SetValue(const CString& strName, const CString& strValue);

	void Matrix(const AcGeMatrix3d& matrix){
		BOOL bResult = m_DicHandle.SetValue(strMatrixName, matrix);
		ASSERT(bResult);
	}

	void EntityHandle(const AcDbHandle& handle){
		BOOL bResult = m_DicHandle.SetValue(strHandleName, handle);
		ASSERT(bResult);
	}

	BOOL IsEntityExist();

	void RemoveSubDictionary(const CString& strName, Dictionary& dic);
protected:
	Dictionary m_DicHandle;

public:
	static const CString strMatrixName;
	static const CString strHandleName;
	static const CString strTypeName;
	static const CString strType;
	static const CString strSHIndexName;
	static const CString strPartIndexName;

private:
	AcDbHandle m_handle;
	AcGeMatrix3d m_Matrix;
};

#endif // !defined(AFX_AUTOCADMODELOBSERVER_H__48A8DEE0_5322_4E36_AB37_1191D4119EF1__INCLUDED_)
